import {isEmpty} from "@/common/util/common";

/**
 * 手机号码脱敏
 * @param {Object} tel
 */
export const maskedPhone = (tel) => {
  try {
    if (isEmpty(tel)) {
      return ''
    }
    tel = tel.toString()
    return tel.substring(0, 3) + '****' + tel.substring(tel.length - 4);
  } catch (e) {
    return ''
  }
  
}
/**
 * 身份证脱敏
 * @param IdentityID
 * @returns {*|string}
 */
export const maskedIdCard = (IdentityID) => {
  try {
    if (isEmpty(IdentityID)) {
      return ''
    }
    return IdentityID.replace(/^(.{3})(?:\d+)(.{4})$/, "$1******$2")
  } catch (e) {
    return ''
  }
}

